Skip to content

feat: 50% decrease Nuget Android part in MAUI #469

Merged
abelonogov-ld merged 27 commits intomainfrom
andrey/ld-android2
Apr 18, 2026
Merged

feat: 50% decrease Nuget Android part in MAUI #469
abelonogov-ld merged 27 commits intomainfrom
andrey/ld-android2

Conversation

@abelonogov-ld
Copy link
Copy Markdown
Contributor

@abelonogov-ld abelonogov-ld commented Apr 15, 2026

Summary

Decouples the Observability and Session Replay SDKs from the LaunchDarkly Android Client SDK (LDClient), making them independently launchable without requiring LDClient at runtime.

Motivation

The MAUI / .NET binding only needs observability and session replay — it never uses LDClient for feature flags. Previously, the observability SDK was tightly coupled to the client SDK through Plugin/Hook base classes, LDLogger, LDContext, and LDLogAdapter. This forced the MAUI build to bundle the entire client SDK and its transitive dependencies (jackson, timber, launchdarkly-logging) even though none of them were used.

Dependency cleanup

build.gradle.kts:

  • launchdarkly-android-client-sdk is compileOnly when built from the MAUI composite build (isIncludedByMaui), implementation otherwise.
  • Removed timber dependency entirely (no longer used in source).

NativeAndroidDeps.props (MAUI NuGet bundle):

  • Removed launchdarkly-android-client-sdk-*.aar
  • Removed timber-*.aar
  • Removed jackson-*.jar
  • Removed launchdarkly-*.jar

Test plan

  • Standalone path: LDObserve.init(application, mobileKey, ldContext, options, replayOptions) initializes observability and session replay without LDClient
  • LDClient path: Observability and SessionReplay plugins still work when registered via LDConfig.Builder.plugins()
  • MAUI build: dotnet build produces a NuGet without LDClient AAR, timber, jackson, or launchdarkly JARs
  • MAUI runtime: observability and session replay work end-to-end on Android via the .NET bridge
  • Unit tests pass: ./gradlew :lib:testDebugUnitTest
  • E2E app compiles and runs with both realInit() and realFlagInit() paths

Note

Medium Risk
Moderate risk due to decoupling from LDClient (new context/logging abstractions and new init path) which changes initialization and session replay identify behavior; dependency/build changes could affect consumers and packaging.

Overview
Adds a standalone initialization path via LDObserve.init(application, mobileKey, ldContext, options, replayOptions) that can start observability and optionally session replay without the LaunchDarkly feature-flag SDK.

Replaces LDContext/LDLogger/LDLogAdapter usage with new lightweight LDObserveContext and ObserveLogger/ObserveLogAdapter (defaulting to Android Log), and updates session replay identify payloads to use this context plus an explicit canonicalKeyOverride.

Updates the .NET MAUI Android bridge and packaging to use the standalone init and drop bundling LDClient/timber/jackson artifacts, including build logic to depend on the client SDK only as compileOnly when included by MAUI; E2E tests are hardened with per-test teardown (LDClient.close()/mock server shutdown) and log assertions that tolerate init-time LD.identify noise.

Reviewed by Cursor Bugbot for commit 6ad6a88. Bugbot is set up for automated code reviews on this repo. Configure here.

@abelonogov-ld abelonogov-ld requested a review from a team as a code owner April 15, 2026 02:03
@launchdarkly-upra
Copy link
Copy Markdown

trufflehog — Issues Found

The trufflehog security scan found issues on commit 0761bc6. Please review the workflow run for details.

Copy link
Copy Markdown
Contributor

@beekld beekld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick review.

Comment thread e2e/android/app/src/main/java/com/example/androidobservability/BaseApplication.kt Outdated
Comment thread e2e/android/app/src/main/java/com/example/androidobservability/BaseApplication.kt Outdated
Comment thread sdk/@launchdarkly/mobile-dotnet/android/native/LDObserve/build.gradle.kts Outdated
Comment thread sdk/@launchdarkly/mobile-dotnet/observability/NativeAndroidDeps.props Outdated
…servability is not initialized or when a session replay already exists, adding logging for clarity.
* main:
  feat: [SDK-2197] Add `LDReplay. registerActivity()` method for React Native. (#472)
  docs: [SDK-2206] add README for .NET AspSampleApp (#473)
  feat: [SDK-2190] add dialogs to the RN session replay example app (#471)
  feat: [SDK-2121] implement session replay for react native android (#456)
…/ld-android2

* andrey/silent-otlp-exceptions-in-e2e-tests:
  silence otlp connection exceptions in e2e tests
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ed2e570. Configure here.

Copy link
Copy Markdown
Contributor

@beekld beekld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine for now.

I think it would be cleaner to separate these into separate libraries eventually, so that we don't have special build config just for MAUI.

It's a shame the other LD SDK is so large. I wonder if we can reduce that, such that this isn't an issue. I'll bring it up with the SDK team.

My only real concern is the unit test failing. Approving on the assumption you get that test working.

* main:
  fix: [SDK-2197] manually register main Activity with session replay (#475)
@abelonogov-ld abelonogov-ld enabled auto-merge (squash) April 17, 2026 22:11
@abelonogov-ld abelonogov-ld merged commit 83d49af into main Apr 18, 2026
25 checks passed
@abelonogov-ld abelonogov-ld deleted the andrey/ld-android2 branch April 18, 2026 00:19
Vadman97 pushed a commit that referenced this pull request Apr 20, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-observability-android: 0.40.0</summary>

##
[0.40.0](launchdarkly-observability-android-0.39.0...launchdarkly-observability-android-0.40.0)
(2026-04-18)


### Features

* 50% decrease Nuget Android part in MAUI
([#469](#469))
([83d49af](83d49af))
</details>

<details><summary>session-replay-react-native: 0.4.1</summary>

##
[0.4.1](session-replay-react-native-0.4.0...session-replay-react-native-0.4.1)
(2026-04-18)


### Bug Fixes

* [SDK-2197] manually register main Activity with session replay
([#475](#475))
([75fd6e7](75fd6e7))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

[SDK-2197]:
https://launchdarkly.atlassian.net/browse/SDK-2197?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Release bookkeeping only (version bumps + changelog entries) with no
functional code changes in this PR. Risk is limited to
publishing/packaging metadata being incorrect.
> 
> **Overview**
> Updates release metadata to publish new SDK versions: bumps
`@launchdarkly/observability-android` to `0.40.0` (including
`gradle.properties` and changelog entry) and
`@launchdarkly/session-replay-react-native` to `0.4.1` (package version
+ changelog).
> 
> Also updates `.release-please-manifest.json` to reflect these new
release versions.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e9bc365. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants